package org.tools.ui.effect
{
	import mx.core.Application;
	import mx.core.UIComponent;
	import mx.effects.Move;
	import mx.managers.PopUpManager;
	
	public class  PopUpEffect 
	{
		private static var move:Move = new Move();

		
		public static function show(target:UIComponent, parent:UIComponent, modal:Boolean=true):void
		{
			var x:int = (parent.width - target.width)/2;
			move.xFrom = x;
			move.xTo   = x;
			move.yFrom = -target.height;
			move.yTo   = 0;
			
			PopUpManager.addPopUp(target, parent, modal);
			move.play([target]);
		}
		
		public static function hide(window:UIComponent, parent:UIComponent):void
		{
			var x:int = (parent.width - window.width)/2;
			move.xFrom = x;
			move.xTo   = x;
			move.yFrom = 0;
			move.yTo   = -window.height;
			
			move.play([window]);
			PopUpManager.removePopUp(window);
		}

	}
}